ansible/roles/common/tasks/main.yml in subspace-0.1.3 vs ansible/roles/common/tasks/main.yml in subspace-0.2.1
- old
+ new
@@ -4,61 +4,91 @@
- name: Set MOTD
template:
src: motd
dest: /etc/motd
- sudo: true
+ become: true
- name: Set hostname
command: hostname {{hostname}}
- sudo: true
+ 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
- sudo: true
+ become: true
- name: apt-get upgrade
apt: upgrade=full
- sudo: true
+ 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
- sudo: true
+ 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}}"
- sudo: true
+ become: true
- name: Create directory to which to deploy
file:
path: /u/apps/{{project_name}}
owner: "{{deploy_user}}"
state: directory
- sudo: true
+ become: true
- include: swap.yml