yum 下载 启动 添加add
- name: install httpd service hosts: nginx tasks: - name: install yum: name=httpd state=present - name: service on service: name=httpd enabled=yes state=started
创建用户:
- name: create user hosts: nginx user: root gather_facts: false vars: user: "test" tasks: - name: create user user: name="{{ user }}"
删除用户
- name: userdel user hosts: nginx user: root gather_facts: false vars: user: "test" tasks: - name: userdel user user: name="{{ user }}" state=absent remove=yes
安装httpd并启动
--- - hosts: nginx tasks: - name: "install httpd" yum: name={{ item }} state=present with_items: - httpd - httpd-devel - name: "chckonfig" service: name=httpd state=started enabled=yes