User Tools

Site Tools


ansible:playbooks

Playbooks

notepad++ installation

---
- name: Notepad++ installation Playbook
  hosts: win_domain
  tasks:
   - name: Installing Notepad++
     win_package:
       path: '\\path\npp.7.9.5.Installer.x64.exe'
       arguments: '/S'
       product_id: 'Notepad++'
       creates_version: '7.95'
       creates_path: 'C:\Program Files\Notepad++\notepad++.exe'
       state: present
     when: ansible_os_family == 'Windows'

per richiamare un playbook:

ansible-playbook playbook.yml

oppure per diventare sudoers:

ansible-playbook -b playbook.yml

Upgrade Linux Various Distribution

Create a file hosts named hosts inside the worikng directory the file hosts contain, for example:

linux:
  hosts:
    davidedoro.it:
    localhost:

the playbook file upgrade_linux.yml:

--
- hosts: linux
  tasks:
  - name: Upgrade all packages on RedHat Systems
    yum:
      name: '*'
      state: latest
    become: yes
    when: ansible_os_family == "RedHat"
  - name: Update Cache on Debian Systems
    apt:
      update_cache: yes
    when: ansible_os_family == "Debian"
  - name: Upgrade
    apt:
      name: "*"
      state: latest
    become: yes
    when: ansible_os_family == "Debian"

to run the playbook using a non root user:

$ ansible-playbook -b -v --ask-become-pass -i hosts upgrade_linux.ym
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
ansible/playbooks.txt · Last modified: 2024/11/10 08:00 by 127.0.0.1