整理自網絡 方便查看nginx
- name: Extract tomcat archive command: chdir=/opt/software /bin/tar xvf /tmp/{{tomcat_bin_file}} -C /opt/software creates={{tomcat_bin_file|regex_replace('(.*).tar.gz$', '\\1') }
- name: check conf.d shell: (cd /etc/nginx/conf.d/; find . -maxdepth 1 -type f) | cut -d'/' -f2 register: files_to_fetch tags: fetch_nginx_conf - name: fetch conf.d fetch: src=/etc/nginx/conf.d/{{ item }} dest=conf_files/nginx_conf/{{ansible_hostname}}_{{ansible_default_ipv4.address}}/conf.d/ flat=yes with_items: files_to_fetch.stdout_lines
- name: my command command: echo stuff when: "'groupname' not in group_names"
ansible-playbook --limit 'all:!oadb01' sync_repos.yml
{{ ansible_default_ipv4.address }} {{ ansible_eth0.ipv4.address }}
- name: check if /opt/xxx is mounted or not command: mountpoint -q /opt/xxx register: volume_stat failed_when: False changed_when: False - name: debug debug: msg="/opt/xxx is mounted" when: volume_stat.rc == 0