--- - name: Test connection ping: - name: Set MOTD template: src: motd dest: /etc/motd become: true - name: Set hostname command: hostname {{hostname}} become: true - name: Set hostname in /etc/hosts lineinfile: dest: "/etc/hosts" line: "127.0.0.1 {{hostname}}" state: present insertafter: "127.0.0.1 localhost" become: true - name: update /etc/hostname copy: content: "{{hostname}}" dest: /etc/hostname become: true - name: Set hostname for systemd hostname: name: "{{hostname}}" become: true - name: install aptitude apt: pkg: aptitude state: present become: true - name: apt-get update apt: update_cache=yes cache_valid_time=86400 become: true - name: apt-get upgrade apt: upgrade=full become: true - name: Set timezone variables copy: content='America/Chicago' dest=/etc/timezone owner=root group=root mode=0644 backup=yes become: true notify: - update timezone - name: Add deploy user user: name: "{{deploy_user}}" state: present generate_ssh_key: yes shell: /bin/bash become: true - name: Add deploy user to adm group so it can view logs in /var/log user: name: "{{deploy_user}}" append: yes groups: "adm" become: true - name: Add sudoers.d file so that deploy can restart services without entering password. copy: src: sudoers-service dest: /etc/sudoers.d/service become: true - name: Update authorized_keys for deploy user copy: src: authorized_keys dest: "/home/{{deploy_user}}/.ssh/authorized_keys" owner: "{{deploy_user}}" become: true - name: Create directory to which to deploy file: path: /u/apps/{{project_name}} owner: "{{deploy_user}}" state: directory become: true - import_tasks: swap.yml