2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-27 08:18:25 +00:00
2015-12-29 13:45:45 +03:00

96 lines
4.8 KiB
YAML

---
# tasks file for add_repos
#- hosts: local
# tasks:
###### MariaDB repo setup for rpm platforms
- name: "Check if MariaDB repo already added CentOS"
stat: path=/etc/yum.repos.d/mariadb.repo
register: mariadb_repo
when: (ansible_distribution == "CentOS")
- name: "Adding MariaDB repo CentOS"
script: ../files/create_mariadb_repo_centos.sh /etc/yum.repos.d/mariadb.repo
when: (ansible_distribution == "CentOS") and mariadb_repo.stat.exists == False
###### epel & ius installation for CentOS
- name: "Check if epel-release is installed CentOS"
when: (ansible_distribution == "CentOS")
shell: rpm -q epel-release | grep "not installed" | wc -l
register: epel_release_check
- name: "Installing epel rpm for CentOS 6"
yum: name=http://dl.iuscommunity.org/pub/ius/stable/CentOS/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/epel-release-6-5.noarch.rpm state=present
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6") and (epel_release_check.stdout == "1")
- name: "Install epel for CentOS 7"
yum: name=epel-release state=present
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "7") and (epel_release_check.rc == 1)
- name: "Check if ius is installed on CentOS 6"
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6")
shell: rpm -q ius-release | grep "not installed" | wc -l
register: ius_rpm_check
- name: "Installing ius rpm for CentOS 6"
yum: name=http://dl.iuscommunity.org/pub/ius/stable/CentOS/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/ius-release-1.0-14.ius.centos6.noarch.rpm state=present
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6") and (ius_rpm_check.stdout == "1")
###### install packages required for node.js & mariadb repo installation in Debian/Ubuntu
- name: "Check if software-properties-common is already installed Debian"
shell: dpkg-query -W software-properties-common | grep "no packages found" | wc -l
when: (ansible_distribution == "Debian")
register: spc_installed
- name: "Install software properties Debian"
apt: name=software-properties-common
when: (ansible_distribution == "Debian") and (spc_installed.stdout == "1")
- name: "Check if python-software-properties is already installed Debian"
shell: dpkg-query -W python-software-properties | grep "no packages found" | wc -l
ignore_errors: yes
when: (ansible_distribution == "Debian")
register: psp_installed
- name: "Install python software properties Debian"
apt: name=python-software-properties
when: (ansible_distribution == "Debian") and (psp_installed.stdout == "1")
- name: "Check if MariaDB key is already installed Debian/Ubuntu"
shell: apt-key list | grep "package-signing-key@mariadb.org" | wc -l
when: (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu")
register: mariadb_key_installed
- name: "Receive MariaDB key Debian/Ubuntu"
apt_key: keyserver=keyserver.ubuntu.com id=0xcbcb082a1bb943db
when: (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") and (mariadb_key_installed.stdout == "0")
- name: "Check if MariaDB repo is already added Debian/Ubuntu"
shell: find /etc/apt/ -name *.list | xargs cat | grep ^[[:space:]]*deb | grep -i mariadb | wc -l
when: (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu")
register: mariadb_repo_deb
- name: "Add MariaDB repo Debian"
apt_repository: repo="deb http://ams2.mirrors.digitalocean.com/mariadb/repo/10.0/debian {{ ansible_distribution_release }} main" update_cache=yes
when: (ansible_distribution == "Debian" and ansible_distribution_major_version >= 6) and (mariadb_repo_deb.stdout == "0")
- name: "Add MariaDB repo Ubuntu"
apt_repository: repo="deb http://ams2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu {{ ansible_distribution_release }} main" update_cache=yes
when: (ansible_distribution == "Ubuntu") and (mariadb_repo_deb.stdout == "0")
- name: "Check if Nodesource repo is already added Debian"
shell: find /etc/apt/ -name *.list | xargs cat | grep ^[[:space:]]*deb | grep -i node | wc -l
when: (ansible_distribution == "Debian")
register: nodesource_repo
- name: "Install Nodesource Node.js repo Debian"
shell: curl -sL https://deb.nodesource.com/setup_0.12 | bash -
when: (ansible_distribution == "Debian") and (nodesource_repo.stdout == 0)
- name: "Update repository cache Debian/Ubuntu"
apt: update_cache=yes
when: (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu")