--- # playbook.yml — Demonstrates core Ansible features for Doom Emacs workflow. # # Navigate: SPC s i (imenu for tasks), SPC s p (grep in project) # Run: SPC m r (ansible-playbook), Lint: flycheck (ansible-lint) - name: Configure web server hosts: webservers become: true vars: app_user: webapp app_port: 8080 packages: - nginx - python3 - python3-pip handlers: - name: Restart nginx ansible.builtin.service: name: nginx state: restarted tasks: - name: Install required packages ansible.builtin.apt: name: "{{ packages }}" state: present update_cache: true - name: Create application user ansible.builtin.user: name: "{{ app_user }}" shell: /bin/bash create_home: true state: present - name: Deploy nginx config from template ansible.builtin.template: src: templates/nginx.conf.j2 dest: /etc/nginx/sites-available/app.conf owner: root group: root mode: "0644" notify: Restart nginx - name: Enable site symlink ansible.builtin.file: src: /etc/nginx/sites-available/app.conf dest: /etc/nginx/sites-enabled/app.conf state: link notify: Restart nginx - name: Ensure nginx is running ansible.builtin.service: name: nginx state: started enabled: true