forked from finallycoffee/base
feat(mosh): add ansible role
This commit is contained in:
30
roles/mosh/tasks/install.yml
Normal file
30
roles/mosh/tasks/install.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Ensure mosh is {{ mosh_state }} (dnf)
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ mosh_packages[_key] }}"
|
||||
state: "{{ mosh_state }}"
|
||||
when:
|
||||
- ansible_facts['pkg_mgr'] in ['dnf', 'dnf5']
|
||||
- _key in mosh_packages.keys()
|
||||
vars:
|
||||
_key: "{{ ansible_distribution | lower }}"
|
||||
|
||||
- name: Ensure mosh is {{ mosh_state }} (apt)
|
||||
ansible.builtin.apt:
|
||||
package: "{{ mosh_packages[_key] }}"
|
||||
state: "{{ mosh_state }}"
|
||||
when:
|
||||
- ansible_facts['pkg_mgr'] in ['apt']
|
||||
- _key in mosh_packages.keys()
|
||||
vars:
|
||||
_key: "{{ ansible_distribution | lower }}"
|
||||
|
||||
- name: Ensure mosh is {{ mosh_state }} (pacman)
|
||||
community.general.pacman:
|
||||
name: "{{ mosh_packages[_key] }}"
|
||||
state: "{{ mosh_state }}"
|
||||
when:
|
||||
- ansible_facts['pkg_mgr'] in ['pacman']
|
||||
- _key in mosh_packages.keys()
|
||||
vars:
|
||||
_key: "{{ ansible_distribution | lower }}"
|
11
roles/mosh/tasks/main.yml
Normal file
11
roles/mosh/tasks/main.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Ensure 'mosh_state' is valid
|
||||
ansible.builtin.fail:
|
||||
msg: >-2
|
||||
Invalid state '{{ mosh_state }}' for 'mosh_state'!
|
||||
Allowed states are {{ mosh_states | join(', ') }}.
|
||||
when: mosh_state not in mosh_states
|
||||
|
||||
- name: Ensure mosh is {{ mosh_state }}
|
||||
ansible.builtin.include_tasks:
|
||||
file: "install.yml"
|
Reference in New Issue
Block a user