commit ee60d76a719c6f913fbdf649f82aede39f1852f2 Author: Adrien Date: Mon Oct 8 19:35:22 2018 +0200 Externalize role diff --git a/tasks/add_repo_Debian.yml b/tasks/add_repo_Debian.yml new file mode 100644 index 0000000..c1c45f9 --- /dev/null +++ b/tasks/add_repo_Debian.yml @@ -0,0 +1,28 @@ +--- +- name: Registering Ubuntu Powershell repository + get_url: + url: https://packages.microsoft.com/config/ubuntu/{{ ansible_distribution_version }}/prod.list + dest: /etc/apt/sources.list.d/microsoft.list + owner: root + group: root + mode: 0644 + when: + - ansible_distribution == "Ubuntu" + +- name: Registering Debian Powershell repository + apt_repository: + repo: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-{{ ansible_distribution_name }}-prod {{ ansible_distribution_name }} main + filename: microsoft.list + state: present + update_cache: yes + mode: 0644 +# owner: root +# group: root + when: + - ansible_distribution == "Debian" + +- name: Install public repository GPG keys + apt_key: + url: /etc/apt/sources.list.d/microsoft.list + state: + diff --git a/tasks/add_repo_RedHat.yml b/tasks/add_repo_RedHat.yml new file mode 100644 index 0000000..82cffde --- /dev/null +++ b/tasks/add_repo_RedHat.yml @@ -0,0 +1,9 @@ +--- +- name: Registering Powershell repository + get_url: + url: https://packages.microsoft.com/config/rhel/7/prod.repo + dest: /etc/yum.repos.d/microsoft.repo + owner: root + group: root + mode: 0644 + diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..7c3887b --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,10 @@ +--- +- name: Include vars for {{ ansible_os_family }} + include_vars: "{{ ansible_os_family }}.yml" + +- name: Define repo for {{ ansible_os_family }} + include_tasks: add_repo_{{ ansible_os_family }}.yml + +- name: Install packages + package: name='{{ powershell_packages }}' state=latest update_cache=yes + diff --git a/vars/Debian.yml b/vars/Debian.yml new file mode 100644 index 0000000..033fb85 --- /dev/null +++ b/vars/Debian.yml @@ -0,0 +1,4 @@ +--- +powershell_packages: + - powershell + diff --git a/vars/RedHat.yml b/vars/RedHat.yml new file mode 100644 index 0000000..033fb85 --- /dev/null +++ b/vars/RedHat.yml @@ -0,0 +1,4 @@ +--- +powershell_packages: + - powershell +