Ansible Module - Services
ステータス値
- hosts: web1
tasks:
- service:
name: httpd
state: started
Make changes in the playbook so that httpd server reloads after copying the file, make sure it does not restart the httpd server.- hosts: all
gather_facts: no
tasks:
- name: Copy Apache welcome file
copy:
src: index.html
dest: /var/www/html/index.html
- name: reload
service:
name: httpd
state: reloaded
port: 80. →443変更後にhttpサービスを再起動する- hosts: all
gather_facts: no
tasks:
- name: Make changes in Apache config
replace:
path: /etc/httpd/conf/httpd.conf
regexp: "^Listen 80"
replace: "Listen 443"
- name: Restart Apache
service:
name: httpd
state: restarted
Nginxをインストールし、再起動するたびに自動的に実行---
- name: nginx
gather_facts: no
hosts: web1
tasks:
- name: install nginx
yum:
name: nginx
state: installed
- name: restart
service:
name: nginx
state: started
enabled: yes
Reference
この問題について(Ansible Module - Services), 我々は、より多くの情報をここで見つけました https://velog.io/@codingdaddy/Ansible-Module-Servicesテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol