Write out a script to the local system that you might want to execute

  - copy:
      content: |
          SET @@SESSION.SQL_LOG_BIN=0;
          DELETE FROM mysql.plugin WHERE name = 'validate_password' AND dl = 'validate_password.so';
      dest: "{{ mysql_ver.config_dir|default(mysql_config_dir) }}/mysql_init.sql"
      owner: root
      group: root
      mode: 0644
      - restart mysql
    tags: [ config ]
    - name: install the scheduled task
      shell: |

          CREATE EVENT e_store_ts
            ON SCHEDULE
          EVERY 10 SECOND
          INSERT INTO test33.mytable VALUES (UNIX_TIMESTAMP());
      register: apache_version
      changed_when: False
        - sql
        - schedular
        - ara

Run a script that already exists in the local context

  - name: 'run local post-deployment script'
    local_action: script ../files/reporting-ara-junit-generate.sh   {{ invocation_uuid.playbook_id }}      {{ ansible_hostname }}
    tags: always

The debian/ubuntu equivalent is

$ dpkg -L apache2-utils

List the files in a package that has not been installed?

For machines of the vintage that I have been working with, (centos-6. centos-7, debian-8) etc, the basic apt and yum tools do not support querying file lists from the remote repo out of the box. CentOS requires the yum-utils package and Debian 8 required apt-file. Once installed you can do this;

$ repoquery -l httpd-tools

The debian/ubuntu equivalent (once apt-file is installed)

$ apt-file list apache2-utils
apache2-utils: /usr/bin/htdbm
apache2-utils: /usr/bin/htdigest
apache2-utils: /usr/bin/htpasswd

Search for packages with version information included

The output from yum search XXX is pretty basic, no versions, no installed status. The alternative is to use list instead which also provides the repo and blocks them into “Installed” or “Available”

$ yum list php-*
Installed Packages
php.x86_64                     5.3.3-49.el6           @base
php-cli.x86_64                 5.3.3-49.el6           @base
Available Packages
php-Analog.noarch              1.0.0-3.git9ab4c9e.el6 epel 

The debian/ubuntu equivalent is

$ apt list php*

Although the output formatting is a little bit unhelpful

Task Debian RedHat
What provides file? dpkg -S which htpasswd rpm -q –whatprovides which htpasswd
Uninstall Package apt remove yum remove