Difference between revisions of "Package (Ansible module)"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
 +
#![[/usr/bin/env ansible-playbook]]
 +
 +
- hosts: localhost
 +
  become: yes
 +
 +
  tasks:
 +
    - package:
 +
          name: sysstat
 +
          state: present
 +
 +
  
 
<pre>
 
<pre>
Line 31: Line 43:
 
== See also ==
 
== See also ==
 
* {{Ansible modules}}
 
* {{Ansible modules}}
 +
 +
[[Category:Ansible]]

Latest revision as of 11:44, 25 November 2020

#!/usr/bin/env ansible-playbook

- hosts: localhost
  become: yes

  tasks:
    - package:
          name: sysstat
          state: present


#!/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[edit]

Advertising: