Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: test
- remote_user: frolov
- become: yes
- # become_method: sudo
- #
- tasks:
- - name: Debug
- debug: msg={{ ansible_os_family }}
- - set_fact: package_name=apache2
- when: ansible_os_family == "Debian"
- - set_fact: package_name=httpd
- when: ansible_os_family == "Redhat"
- - name: Update cache packages
- apt:
- update_cache: yes
- cache_valid_time: 3600
- # #
- # - name: Final_packet
- # debug: msg={{ package_name }}
- - name: Install Apache2
- apt:
- name: "{{ item }}"
- state: latest
- with_items:
- - "{{ package_name }}"
- when: ansible_os_family == "Debian"
- - name: Install httpd2
- apt:
- name: "{{ item }}"
- state: latest
- with_items:
- - "{{ package_name }}"
- when: ansible_os_family == "Redhat"
- fatal: [10.101.251.157]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefinednnThe error appears to have been in '/etc/ansible/playbook/apache_install.yml': line 26, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: Install Apache2n ^ herennexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>nexception: 'item' is undefined"}
- to retry, use: --limit @/etc/ansible/playbook/apache_install.retry
- ---
- - name: install php5.6
- include_tasks: centos_php56.yml
- when: (ansible_distribution == "CentOS") and (php.version == "5.6")
- - name: install php7.0
- include_tasks: centos_php70.yml
- when: (ansible_distribution == "CentOS") and (php.version == "7.0")
- - name: install php56
- yum: name={{ item }} state=latest
- with_items:
- - php56w
- - php56w-opcache
- - php56w-pdo
- - php56w-mysql
- - php56w-mbstring
- - php56w-mcrypt
- - php56w-pear
- - php56w-pecl-apcu
- - php56w-gd
- notify: restart httpd
- - name: install php
- yum: name=php state=latest
- notify: restart httpd
- - set_fact:
- package_name=git
- - name: yum install packages
- yum:
- name: "{{ package_name }}"
- state: latest
- when:
- ansible_os_family == "Centos"
- TASK [git : yum install packages]
- **********************************************
- fatal: [server.company.tld]: FAILED! => {"changed": false, "failed": true, "msg": "Unsupported parameters for (yum) module: when Supported parameters include: allow_downgrade,conf_file,disable_gpg_check,disablerepo,enablerepo,exclude,install_repoquery,installroot,list,name,security,skip_broken,state,update_cache,validate_certs"}
- ---
- - name: yum install packages
- yum:
- name: git
- state: latest
- when:
- ansible_os_family == "Centos"
- ---
- - set_fact:
- package_name="git"
- - name: yum install packages
- yum:
- name: "{{ item }}"
- state: latest
- with_items:
- - "{{ package_name }}"
Add Comment
Please, Sign In to add comment