1. Ansible common¶
1.1. Introduction¶
1.2. Ansible driver overview¶
1.2.1. Ansible Core¶
1.2.2. Ansible Automation Controller¶
1.2.3. Ansible Execution Agent¶

1.2.4. Ansible driver¶

- Legacy modeUses Ansible's standard functions to input settings to the host.The Legacy mode registers construction code as single YAML files and creates operation patterns using them.Often used for configuring environments for Server, Storage and Network devices.
- Legacy Role modeSimilar to the Legacy mode, this mode also uses Ansible's standard functions to input settings to the host.The Legacy Role mode registers consdtruction code as packages and creates operation patterns by combining them with Roles.Often used by using Role packages provided by product and other departments to install products and construct environments.
- Pioneer modeAdds original modules to Ansible and allows users to input settings in an interactive format.Support Server, Storage and Network devices that can be logged in with Telnet or SSH. We recommend that the user has adequate IT skills, since this mode works directly with the target host.
1.3. Handling variables with Ansible driver¶
1.3.1. Variable types¶
Normal¶
# Ansible-LegacyRole variable definition example
user: user1
# Playbook example
- name: Create user
user:
name: "{{ user }}"
Multiple specific value variables¶
# Ansible-LegacyRole variable definition example
users:
- user1
- user2
# Playbook example
- name: Create user
user:
name: "{{ item }}"
with_items: "{{ users }}"
Multistage variables¶
# Ansible-LegacyRole variable definition example
users:
- name: user3
groups: root
- name: user4
groups: root
# Playbook example
- name: Create user
user:
name: "{{ item.name }}"
with_items: "{{ users }}"
Global variables¶
- command: echo {{ GBL_user }}
Template embedded variables¶
- template: src={{ TPF_SAMPLE }} dest=/tmp/SAMPLE.txt
File embedded variables¶
- copy: src={{ CPF_SAMPLE }} dest=/tmp/SAMPLE.txt
ITA original variables¶
Device list¶
Item name |
Variable name |
---|---|
Host name |
__inventory_hostname__ |
DNS host name |
__dnshostname__ |
IP address |
__ipaddress__ |
Protocol |
__loginprotocol__ |
Login user ID |
__loginuser__ |
Login password |
__loginpassword__ |
Tip
Movement ID¶
Item name |
Variable name |
---|---|
Movement ID |
__movement_id__ |
Operation¶
Item name |
Variable name |
---|---|
Operation |
__operation__ |
Operation instance ID¶
Item name |
Variable name |
---|---|
Operation instance ID |
__execution_no__ |
Conductor instance ID¶
Item name |
Variable name |
---|---|
Conductor instance ID |
__conductor_id__ |
Link data¶
Item name |
Variable name |
---|---|
Operation directory path |
__workflowdir__ |
Item name |
Variable name |
---|---|
Conductor operation directory path |
__conductor_workflowdir__ |
Item name |
Variable name |
---|---|
Status file path |
__movement_status_filepath__ |
Item name |
Variable name |
---|---|
Path for operation directory (in) 's "_parameters" |
__parameters_dir_for_epc__ |
Path for operation directory (in) 's "_parameters_file" |
__parameters_file_dir_for_epc__ |
Path for operation directory (out) 's "_parameters" |
__parameter_dir__ |
Path for operation directory (out) 's "_parameters_file" |
__parameters_file_dir__ |
1.3.2. Extracting variables and registering specific variables¶
Variable extraction files¶
Tip
Playbook file extractable variable types and their format¶
Tip
Interactive file extractable variable types and their format¶
Tip
Local package file (ZIP format) extractable variable types and their format.¶
Tip
Tip
Inventory file options and header section parameter value extractable variable types and their format.¶
Tip
Specific values for variables¶
Ansible-Legacy¶

図 1.60 Variable's specific values in Ansible-Legacy host variable files¶
Ansible-Pioneer¶

図 1.61 Variable's specific values in Ansible-Pioneer host variable files¶
Ansible-LegacyRole¶

図 1.62 Variable's specific values in Ansible-LegacyRole host variable files¶
- Host variable definition file value
- values defined in defaults variable definition file
1.6. Appendix¶
1.6.2. BackYard contents¶
Ansible Automation Controller data synchronization¶
Resource |
Application |
---|---|
Organization name |
Used with the
list selection in .Organizations can be seen by users who input the
's . |
Instance group |
Used with the
list selection in .Instance groups can be seen by organizations selected in
's . |
Execution environment |
Used with the
list selection in .Execution envrionments can be seen by organizations selected in
's . |
1.6.3. Inventory files created by ITA.¶
all:
children:
hostgroups:
hosts:
Inventory_host:
Inventory_host_parameters:
Inventory_host_option_parameters:
Parameter name |
's |
Certificate authentic| action |
|
|||||
---|---|---|---|---|---|---|---|
Password authentication |
Key authentication
|
Key authentication
|
Key authentication
|
Password authentication Authentication (winrm) |
|||
ansible_host |
〇 |
〇 |
〇 |
〇 |
〇 |
|
|
ansible_user |
〇 |
〇 |
〇 |
〇 |
〇 |
's :menuselection:` login user` |
|
ansible_password |
〇 |
〇 |
's |
||||
ansible_ssh_private_key_file |
〇 |
〇 |
's |
||||
ansible_ssh_extra_args |
〇 |
〇 |
〇 |
〇 |
's |
||
ansible_connection: |
〇 |
〇 | winrm |
|||||
ansible_port |
〇 |
〇 | 's |
|||||
ansible_winrm_ca_trust_path |
〇 |
〇 | 's |
|||||
ansible_winrm_cert_key_pem |
〇 |
〇 | 's ' |
Tip
1.6.4. Option parameter list¶
- の
- の
ansible-playbook -h
オプションパラメータ |
指定方法 |
Ansible Automation Controllerの設定箇所 |
備考 |
---|---|---|---|
-v
--verbose
|
-v
-vv
-vvv
-vvvv
-vvvvv
--verbose
|
の に v の数が設定される。 |
・vの合計値を適用
・--verboseは、-vと同様
例:--verbose -vvv の場合、-vvvvと同様
・vを6以上指定した場合 、vは5の指定となる
|
-f
--forks
|
-f FORKS
--forks=FORKS
|
の にFORKSの値が設定される。 |
・FORKSには数値を指定
・複数定義した場合、最後に定義したパラメータが有効
例:-f 1-forks=10の場合、--forks=10が有効となる
・数値以外が指定された場合、エラーとなる
|
-l
--limit
|
-l SUBSET
--limit=SUBSET
|
の にSUBMITの値が設定される。 |
・SUBSET:機器一覧にあるホスト名
・複数定義した場合、最後に定義したパラメータが有効
|
-e
--extra-vars
|
-e EXTRA_VARS
--extra-vars=EXTRA_VARS
|
の にEXTRA_VARSの値が設定される。 |
・EXTRA_VARS:変数名、具体値をjson形式またはyaml形式
e.g.) json形式の場合
-extra-vars={"VAR_1":"directory"}
e.g.) yaml形式の場合
-extra-vars=VAR_1:directory
・複数定義した場合、最後に定義したパラメータが有効
|
-t
--tags
|
-t TAGS
--tags=TAGS
|
の にTAGSの値が設定される。 |
・TAGS:タグ名
・複数個のパラメータを許容
|
-b
--become
|
-b
--become
|
の がチェックされる。 |
・少なくとも1つ指定すればパラメータが有効 |
-D
--diff
|
-D
--diff
|
の の表示が有効化される。 |
・少なくとも1つ指定すればパラメータが有効 |
--skip-tags |
--skip-tags=SKIP_TAGS |
の にSKIP_TAGSの値が設定される。 |
・SKIP_TAGS:スキップタグ名
・複数個のパラメータを許容
|
--start-at-task |
--start-at-task=START_AT_TASK |
※Ansible Automation ControllerのWebUI には--start-at-taskの表示はありません。
ansible-playbookコマンドの--start-at-taskと同様の扱いになります。
|
・複数定義した場合、最後に定義したパラメータが有効 |
-ufc
--use _fact_cache
|
-ufc
--use_fact_cache
|
の がチェックされる。 |
・少なくとも1つ指定すればパラメータが有効 |
-as
--allow_simultaneous
|
-as
--allow_simultaneous
|
の がチェックされる。 |
・少なくとも1つ指定すればパラメータが有効 |
-jsc
--jobslice_count
|
-jsc ジョブスライス数
--job_slice_count=ジョブスライス数
|
の にジョブスライス数の値が設定される。 |
・ジョブスライス数には数値を指定
・複数定義した場合、最後に定義したパラメータが有効
|
1.6.5. Data resources deleted when executed¶
¶
の が「Ansible Automation Controller」の場合データリソース |
リソースタイプ |
備考 |
---|---|---|
ITA作業用ディレクトリ /var/lib/exastro/ita_<区分>_executions_作業番号 |
ディレクトリ |
|
SCM管理ディレクトリ /var/lib/awx/projects/ita_<区分>_executions_作業番号 |
ディレクトリ |
※プロジェクトリソースの削除により削除される |
インベントリ リソース名: ita_<区分>_executions_inventory_作業番号_通番 |
リソース |
|
認証情報 リソース名: ita_<区分>_executions_credential_作業番号_通番 ita_<区分>_executions_vault_credential_作業番号 ita_<区分>_executions_git_credential_作業番号 |
リソース |
|
プロジェクト リソース名: ita_<区分>_executions_project_作業番号 |
リソース |
|
ジョブテンプレート リソース名: ita_<区分>_executions_jobtpl_作業番号_通番 |
リソース |
|
ワークフロージョブテンプレート リソース名: ita_<区分>_executions_workflowtpl_作業番号 |
リソース |
|
ジョブ リソース名: Job番号—ita_<区分>_executions_workflowtpl_作業番号 Job番号—ita_<区分>_executions_jobtpl_作業番号 |
リソース |
注釈
データリソース |
リソースタイプ |
備考 |
---|---|---|
Git リポジトリ /tmp/git_repositories/<区分>_作業番号 |
Gitリポジトリ |
ディレクトリごと削除 ※ の 設定値に関係なく削除される。 |
¶
の が「Ansible Execution Agent」の場合データリソース |
リソースタイプ |
備考 |
---|---|---|
ITA作業用ディレクトリ <storage>/<org>/<ws>/driver/ag_ansible_execution/<区分>/作業番号 <storage>/<org>/<ws>/ag_ansible_execution/status |
ディレクトリ |
注釈