Skip to content

Commit

Permalink
role update
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Sep 11, 2019
1 parent bfe8005 commit 7a56f1f
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 60 deletions.
29 changes: 0 additions & 29 deletions menu/functions/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,36 +324,7 @@ bash /opt/plexguide/menu/roles/pythonstart/pyansible.sh >/dev/null 2>&1
}

dockerinstall() {
ospgversion=$(cat /var/plexguide/os.version)
if [ "$ospgversion" == "debian" ]; then
ansible-playbook /opt/plexguide/menu/pg.yml --tags dockerdeb
else
ansible-playbook /opt/plexguide/menu/pg.yml --tags docker
# If Docker FAILED, Emergency Install
file="/usr/bin/docker"
if [ ! -e "$file" ]; then
clear
echo "Installing Docker the Old School Way - (Please Be Patient)"
sleep 2
clear
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
echo ""
echo "Starting Docker (Please Be Patient)"
sleep 2
systemctl start docker
sleep 2
fi

##### Checking Again, if fails again; warns user
file="/usr/bin/docker"
if [ -e "$file" ]; then
sleep 5
else
echo "INFO - FAILED: Docker Failed to Install! Exiting PGBlitz!"
exit
fi
fi
}

serverid() {
Expand Down
1 change: 0 additions & 1 deletion menu/pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
roles:
- { role: docker, tags: ['docker'] }
- { role: docstart, tags: ['docstart'] }
- { role: dockerdeb, tags: ['dockerdeb'] }
- { role: autodelete, tags: ['autodelete'] }
- { role: clean, tags: ['clean'] }
- { role: clean-encrypt, tags: ['clean-encrypt'] }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions menu/roles/docker/tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- name: Update the apt package index
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes

- name: Install packages for apt add repository over HTTPS
become: yes
apt:
name: "{{ packagesdep }}"
force_apt_get: yes
state: latest
update_cache: yes
vars:
packagesdep:
- git
- apt-transport-https
- ca-certificates
- wget
- software-properties-common
- gnupg2
- curl

- name: Add Apt signing key from official docker repo
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present

- name: add docker official repository for Debian Stretch
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
state: present

- name: Index new repo into the cache
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes

- name: actually install docker
apt:
name: "docker-ce"
state: latest
36 changes: 6 additions & 30 deletions menu/roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# GNU: General Public License v3.0
################################################################################
---
- include_tasks: debian.yml
when: ansible_os_family == 'Debian'

- include_tasks: ubuntu.yml
when: ansible_os_family == 'Ubuntu'

- name: 'Establish Facts'
set_fact:
switch: 'on'
Expand Down Expand Up @@ -48,36 +54,6 @@
- check.stat.exists == True
- switch == "on"

- name: Official Repo
apt_repository:
repo: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} edge'
register: apt_docker_repositories
when: switch == "on"

- name: Update APT packages list
apt:
update_cache: yes
when: apt_docker_repositories.changed and switch == "on"

- name: Release docker-ce from hold
dpkg_selections:
name: docker-ce
selection: install
when: switch == "on"

- name: Install docker-ce
apt:
name: docker-ce
state: latest
update_cache: yes
when: switch == "on"

- name: Put docker-ce into hold
dpkg_selections:
name: docker-ce
selection: hold
when: switch == "on"

- name: Uninstall docker-py pip module
pip:
name: docker-py
Expand Down
46 changes: 46 additions & 0 deletions menu/roles/docker/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- name: Update the apt package index
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes

- name: Install packages for apt add repository over HTTPS
become: yes
apt:
name: "{{ packagesdep }}"
force_apt_get: yes
state: latest
update_cache: yes
vars:
packagesdep:
- software-properties-common
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common

- name: Add Apt signing key from official docker repo
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present

- name: add docker official repository for Ubuntu
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
state: present

- name: Index new repo into the cache
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes

- name: actually install docker
apt:
name: "docker-ce"
state: latest

0 comments on commit 7a56f1f

Please sign in to comment.