Docsite: fix user_guide/playbooks_environment (#71772)

This commit is contained in:
Andrew Klychkov 2020-09-17 17:17:05 +03:00 committed by GitHub
parent 195c8b496e
commit a204f5f955
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,7 @@ You can set the environment directly at the task level::
tasks: tasks:
- name: Install cobbler - name: Install cobbler
package: ansible.builtin.package:
name: cobbler name: cobbler
state: present state: present
environment: environment:
@ -42,7 +42,7 @@ You can re-use environment settings by defining them as variables in your play a
tasks: tasks:
- name: Install cobbler - name: Install cobbler
package: ansible.builtin.package:
name: cobbler name: cobbler
state: present state: present
environment: "{{ proxy_env }}" environment: "{{ proxy_env }}"
@ -94,19 +94,19 @@ Some language-specific version managers (such as rbenv and nvm) require you to s
PATH: /var/local/nvm/versions/node/v4.2.1/bin:{{ ansible_env.PATH }} PATH: /var/local/nvm/versions/node/v4.2.1/bin:{{ ansible_env.PATH }}
tasks: tasks:
- name: check for package.json - name: Check for package.json
stat: ansible.builtin.stat:
path: '{{ node_app_dir }}/package.json' path: '{{ node_app_dir }}/package.json'
register: packagejson register: packagejson
- name: npm prune - name: Run npm prune
command: npm prune ansible.builtin.command: npm prune
args: args:
chdir: '{{ node_app_dir }}' chdir: '{{ node_app_dir }}'
when: packagejson.stat.exists when: packagejson.stat.exists
- name: npm install - name: Run npm install
npm: community.general.npm:
path: '{{ node_app_dir }}' path: '{{ node_app_dir }}'
when: packagejson.stat.exists when: packagejson.stat.exists
@ -119,8 +119,8 @@ Some language-specific version managers (such as rbenv and nvm) require you to s
You can also specify the environment at the task level:: You can also specify the environment at the task level::
--- ---
- name: install ruby 2.3.1 - name: Install ruby 2.3.1
command: rbenv install {{ rbenv_ruby_version }} ansible.builtin.command: rbenv install {{ rbenv_ruby_version }}
args: args:
creates: '{{ rbenv_root }}/versions/{{ rbenv_ruby_version }}/bin/ruby' creates: '{{ rbenv_root }}/versions/{{ rbenv_ruby_version }}/bin/ruby'
vars: vars: