Ansible - Command

Card Puncher Data Processing

About

command is the default module of the ansible command line and helps you execute adhoc (on the fly) command.

You may also want to check the shell module

Example

A long command

- name: Install | Installing Netdata from {{ netdata_source_dir }} to {{ netdata_prefix }}
  command: "{{ command_args|join(' ') }}"
  vars:
    command_args:
      - "./netdata-installer.sh"
      - "--install {{ netdata_install_path }}"
      - "{{ auto_update_cli_option }}" # Install netdata-updater in cron to update netdata automatically once per day
      - "--stable-channel" # fetch and install only the official releases from GitHub
      - "--dont-wait" # Run installation in non-interactive mode
  args:
    chdir: "{{ netdata_source_dir }}"
    creates: "{{ netdata_config_file }}" # after installation, the conf file is created
  notify: restart netdata





Discover More
Card Puncher Data Processing
Ansible - Ad-hoc command

Adhoc command are command executed as in the shell via ansible. You can therefore execute command on a whole cluster of server. This is because the default module of the ansible command line is command...



Share this page:
Follow us:
Task Runner