1
0
mirror of https://github.com/jcwimer/startup-infrastructure synced 2026-03-24 14:24:43 +00:00
Files
startup-infrastructure/roles/common/tasks/main.yml
2018-10-10 09:40:00 -04:00

88 lines
2.0 KiB
YAML

---
# This playbook contains plays that will run on all nodes
- name: Add docker key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add docker repo
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
state: present
- name: Update apt
apt: update_cache=yes
#- name: Upgrade APT to the lastest packages
# apt: upgrade=dist
- name: Install standard programs
apt: name={{ item }} state=present force=yes
with_items:
- htop
- curl
- openssh-server
- git
- rsync
- zip
- unzip
- fail2ban
- ntp
- mysql-client
- wget
- nfs-common
- sshpass
- ack-grep
- dnsutils
- nmon
- build-essential
- tmux
- sudo
- name: Install docker-ce
shell: >
apt-get install -y -qq docker-ce=$(apt-cache madison docker-ce | grep "{{ docker_ce_version_to_install }}" | awk {'print $3'})
- name: Add standard_user to docker group
user:
name: "{{ standard_user }}"
groups: docker
append: yes
- name: Docker compose version
get_url:
url: "https://github.com/docker/compose/releases/download/{{docker_compose_version_to_install}}/docker-compose-{{ ansible_system }}-{{ ansible_userspace_architecture }}"
dest: /usr/local/bin/docker-compose
validate_certs: false
mode: 755
group: docker
- name: Set timezone to NewYork
timezone:
name: "{{ chosen_timezone }}"
ignore_errors: true
- name: Replace sudoers file
template: src=../roles/common/templates/sudoers.j2 dest=/etc/sudoers
- name: Create /etc/docker
file:
path: /etc/docker
group: root
owner: root
mode: 700
state: directory
- name: Replace docker daemon file
template: src=../roles/common/templates/docker-daemon.json.j2 dest=/etc/docker/daemon.json
register: dockerdaemon
- name: Restart docker if daemon changes
service:
name: docker
state: restarted
when: dockerdaemon.changed
- name: Creates directory
file: path=/data state=directory