- name: Install Nginx on Ubuntu hosts: servers remote_user: ptrowbridge become: true tasks: - name: Add Nginx signing key become: yes apt_key: url: http://nginx.org/keys/nginx_signing.key state: present - name: Add Nginx APT repository (stable version) apt_repository: repo: "deb http://nginx.org/packages/ubuntu {{ ansible_distribution_release }} nginx" state: present filename: nginx - name: Update apt cache apt: update_cache: yes - name: Install Nginx apt: name: nginx state: present - name: Start Nginx service using service module service: name: nginx state: started