Made common task idempotent
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
# This playbook contains plays that will run on all nodes
|
||||
|
||||
- name: Get docker key
|
||||
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
apt-key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
# shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
|
||||
- name: Add docker repo
|
||||
apt_repository:
|
||||
@@ -32,16 +35,34 @@
|
||||
- nfs-common
|
||||
- docker-ce={{docker_ce_version_to_install}}
|
||||
- sshpass
|
||||
- ack-grep
|
||||
- dnsutils
|
||||
- nmon
|
||||
- build-essential
|
||||
- linux-headers-server
|
||||
- tmux
|
||||
|
||||
- name: Set git username
|
||||
- name: Set authorized key took from url
|
||||
become: yes
|
||||
become_user: cody
|
||||
shell: git config --global user.name "Jacob Cody Wimer"
|
||||
authorized_key:
|
||||
user: cody
|
||||
state: present
|
||||
key: {{ home_pub_key }}
|
||||
|
||||
- name: Set git email
|
||||
- git_config:
|
||||
become: yes
|
||||
become_user: cody
|
||||
shell: git config --global user.email "jacob.wimer@gmail.com"
|
||||
name: user.name
|
||||
scope: local
|
||||
value: 'Jacob Cody Wimer'
|
||||
|
||||
- git_config:
|
||||
become: yes
|
||||
become_user: cody
|
||||
name: user.email
|
||||
scope: local
|
||||
value: 'jacob.wimer@gmail.com'
|
||||
|
||||
- name: Docker compose version
|
||||
shell: docker-compose --version
|
||||
@@ -59,26 +80,35 @@
|
||||
docker_compose_version.stdout != "docker-compose version: {{docker_compose_version_to_install}}"
|
||||
|
||||
- name: Set timezone to NewYork
|
||||
shell: timedatectl set-timezone America/New_York
|
||||
timezone:
|
||||
name: America/New_York
|
||||
|
||||
- name: Replace sudoers file
|
||||
template: src=../roles/common/templates/sudoers.j2 dest=/etc/sudoers
|
||||
|
||||
- name: Replace fstab file
|
||||
template: src=../roles/common/templates/fstab.j2 dest=/etc/fstab
|
||||
lineinfile: dest=/etc/fstab
|
||||
regexp="^{{ nfs_location }}"
|
||||
state=present
|
||||
line="{{ nfs_location }}:/volumeUSB1/usbshare/raw-files/fileserver/shares/lab-data /data nfs defaults 0 0"
|
||||
|
||||
|
||||
- name: Replace docker daemon file
|
||||
template: src=../roles/common/templates/docker-daemon.json.j2 dest=/etc/docker/daemon.json
|
||||
register: docker-daemon
|
||||
|
||||
- name: Restart docker service
|
||||
shell: service docker restart
|
||||
when: docker-daemon.changed
|
||||
|
||||
- name: Creates directory
|
||||
file: path=/data state=directory
|
||||
|
||||
- name: Mount data directory
|
||||
shell: mount 10.0.0.150:/volumeUSB1/usbshare/raw-files/fileserver/shares/lab-data /data
|
||||
ignore_errors: yes
|
||||
mount:
|
||||
path: /data
|
||||
src: 10.0.0.150:/volumeUSB1/usbshare/raw-files/fileserver/shares/lab-data
|
||||
state: present
|
||||
|
||||
- name: test for swap partition
|
||||
shell: swapon -s | grep -E "^/"
|
||||
@@ -131,4 +161,4 @@
|
||||
lineinfile: dest=/etc/sysctl.conf
|
||||
regexp="^vm.vfs_cache_pressure"
|
||||
state=present
|
||||
line="vm.swappiness = 50"
|
||||
line="vm.vfs_cache_pressure = 50"
|
||||
|
||||
Reference in New Issue
Block a user