Update for CentOS 8 and tags
This commit is contained in:
parent
ee60d76a71
commit
c07a4980e6
6 changed files with 55 additions and 9 deletions
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
powershell_uninstall: false
|
||||||
|
|
@ -24,5 +24,4 @@
|
||||||
- name: Install public repository GPG keys
|
- name: Install public repository GPG keys
|
||||||
apt_key:
|
apt_key:
|
||||||
url: /etc/apt/sources.list.d/microsoft.list
|
url: /etc/apt/sources.list.d/microsoft.list
|
||||||
state:
|
state: present
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Registering Powershell repository
|
- name: Registering Powershell repository
|
||||||
get_url:
|
get_url:
|
||||||
url: https://packages.microsoft.com/config/rhel/7/prod.repo
|
url: https://packages.microsoft.com/config/rhel/{{ ansible_distribution_major_version }}/prod.repo
|
||||||
dest: /etc/yum.repos.d/microsoft.repo
|
dest: /etc/yum.repos.d/microsoft.repo
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
|
||||||
6
tasks/install.yml
Normal file
6
tasks/install.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- 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
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
---
|
---
|
||||||
- name: Include vars for {{ ansible_os_family }}
|
- block:
|
||||||
include_vars: "{{ ansible_os_family }}.yml"
|
- name: Include vars for {{ ansible_os_family }}
|
||||||
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
|
||||||
- name: Define repo for {{ ansible_os_family }}
|
- name: Install PowerShell
|
||||||
include_tasks: add_repo_{{ ansible_os_family }}.yml
|
include_tasks: "install.yml"
|
||||||
|
when:
|
||||||
|
- not powershell_uninstall|bool
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
|
||||||
- name: Install packages
|
- name: Uninstall PowerShell
|
||||||
package: name='{{ powershell_packages }}' state=latest update_cache=yes
|
include_tasks: "uninstall.yml"
|
||||||
|
when:
|
||||||
|
- powershell_uninstall|bool
|
||||||
|
tags:
|
||||||
|
- uninstall
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- powershell
|
||||||
26
tasks/uninstall.yml
Normal file
26
tasks/uninstall.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
- name: Remove PowerShell's files
|
||||||
|
file:
|
||||||
|
path: "/etc/yum.repos.d/microsoft.repo"
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
|
- name: Registering Ubuntu PowerShell repository
|
||||||
|
file:
|
||||||
|
path: "/etc/apt/sources.list.d/microsoft.list"
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
- name: Registering Debian AnsiPowerShellble 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: absent
|
||||||
|
update_cache: yes
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Debian"
|
||||||
|
|
||||||
|
- name: Remove AnsiPowerShellble's packages
|
||||||
|
package: name='{{ powershell_packages }}' state=absent update_cache=yes
|
||||||
Loading…
Add table
Add a link
Reference in a new issue