--- - name: Install nginx package apt: name: nginx state: present - name: Install certbot package apt: name: ['certbot', 'python3-certbot-nginx'] state: present - name: install nginx config template: src: files/nginx.conf dest: /etc/nginx/nginx.conf owner: www-data - name: remove default config file: path: /etc/nginx/sites-enabled/default state: absent owner: www-data - name: install site's configs template: src: files/sites-enabled/{{ item }} dest: /etc/nginx/sites-enabled/{{ item }} owner: www-data loop: ['wiki.conf', 'root.conf', 'pma.conf', 'default_server.conf', 'cloud.conf'] - name: create dirs file: path: /var/www/{{item}} state: directory owner: www-data loop: ['pma','cloud','wiki','default','root'] - name: stop nginx service: name: nginx state: stopped - name: Get certs using certbot shell: echo "cock" - name: start nginx service: name: nginx state: started