--- - name: Test connection ping: - name: Ensure /etc/profile.d/ exists file: path: "/etc/profile.d/" owner: root state: directory become: yes - name: Set terminal color vars: terminal_env_playbook: "{{terminal_env | default('not provided', true) }}" template: src: terminalcolor dest: "/etc/profile.d/termcolor.sh" mode: a+x become: true - 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 tags: - upgrade - name: /usr/lib/update-notifier/apt-check --human-readable command: /usr/lib/update-notifier/apt-check --human-readable tags: - upgrade register: out - name: Creates /opt/subspace file: path: /opt/subspace state: directory become: true - name: Save updates to /opt/subspace/updates.log lineinfile: path: /opt/subspace/updates.log line: "[{{ out.end }}]\n{{ out.stdout }}" insertafter: EOF create: yes become: true - name: apt-get upgrade apt: upgrade=full become: true tags: - upgrade - name: apt-get autoremove apt: autoremove: true become: true tags: - upgrade - name: set timezone to America/Chicago timezone: name: America/Chicago - 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 tags: - authorized_keys - name: Create directory to which to deploy file: path: /u/apps/{{project_name}} owner: "{{deploy_user}}" state: directory become: true - import_tasks: swap.yml