Package (Ansible module)

From wikieduonline
Revision as of 09:14, 29 April 2020 by Welcome (talk | contribs) (Created page with "#!/usr/bin/env ansible-playbook - hosts: YOUR_HOSTNAME remote_user: YOUR_REMOTEUSER become: yes connection: ssh tasks: - name: Install and start as service sys...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. !/usr/bin/env ansible-playbook

- hosts: YOUR_HOSTNAME

 remote_user: YOUR_REMOTEUSER 
 become: yes
 connection: ssh
 tasks:
   - name: Install and start as service sysstat for Ubuntu 
     block:
     - package:
         name: sysstat
         state: present	
     - lineinfile:
         path: /etc/default/sysstat
         state: present
         backrefs: yes
         regexp: '^ENABLED="false"'
         line: 'ENABLED="true"'
     - service:
         name: sysstat
         state: started
         enabled: yes
     when: ansible_distribution == 'Ubuntu'

See also

Advertising: