1.1.2.5. Ansibleの準備をする

本書中の設定値の「< >」の表記については、ご利用の環境により各自入力いただく箇所となります("<"から">"までを設定値に置き換えてください)。
各コマンドの実行については、rootユーザーに昇格して実行する前提で記載しています。

各種ツールをインストールする

  1. 以下のコマンドを実行し、「EPELリポジトリ」をインストールします。
    # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    
  2. 以下のコマンドを実行し、「Ansible」をインストールします。
    # yum install ansible
    
  3. 以下のコマンドを実行し、「Ansible」がインストールされていることを確認します(本項記載時の「Ansible」のバージョンは"2.9.21"です)。
    # ansible --version
    
    ansible 2.9.21
      ansible 2.9.21
      config file = /etc/ansible/ansible.cfg
      configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python3.6/site-packages/ansible
      executable location = /usr/bin/ansible
      python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
    
  4. 以下のコマンドを実行し、「ncclient」をインストールします。
    # pip install ncclient
    
  5. 以下のコマンドを実行し、「ncclient」がインストールされていることを確認します。(本項記載時の「ncclient」のバージョンは"0.6.13"です)。
    # pip list | grep ncclient
    
    ncclient    0.6.13
    

スクリプトを作成する

  1. 以下のコマンドを実行し、作業ディレクトリまで移動します。
    # cd /etc/ansible/
    

    注釈

    • 配下には以下のディレクトリとファイルがデフォルトで作成されています。
      「roles」:Ansibleのrole機能を用いる際に使用するディレクトリです。本手順ではroles配下にスクリプトを記載したファイル(.yml)を作成します。
      「hosts」:操作対象について記載するファイルです。
      「ansible.cfg」:Ansibleの実行環境について記載するファイルです。初期状態ではすべてコメントアウトされており、本手順では初期状態のまま使用します。
    本手順では下記のとおりディレクトリとファイルを作成します。
    /etc/ansible/
    |- playbook_vsrx01.yml (任意の名称)
    |- playbook_vsrx02.yml (任意の名称)
    |- hosts (任意の名称)
    |- ansible.cfg (名称固定)
    |- roles (名称固定)
      |- vsrx01_conf (任意の名称)
        |- tasks (名称固定)
          |- main.yml
          |- 1-1_zone_trust.yml
          |- 1-2_zone_inetgw.yml
          |- 1-3_zone_vm.yml
          |- 1-4_nat_to-inet.yml
          |- 1-5_nat_to-common-function.yml
          |- 1-6_policy_vm_common-function.yml
          |- 1-7_policy_vm_inetgw.yml
          |- 1-8_policy_vm_trust.yml
          |- 1-9_policy_trust_vm.yml
          |- 1-10_policy_inetgw_trust.yml
          |- 1-11_policy_inetgw_vm.yml
          |- 1-12_static-route.yml
          |- 1-13_vrrp-interface0.yml
          |- 1-14_vrrp-interface1.yml
          |- 1-15_vrrp-interface2.yml
          |- 1-16_vrrp-interface3.yml
          |- show_configuration.yml
      |- vsrx02_conf (任意の名称)
        |- tasks (名称固定)
          |- main.yml
          |- 1-1_zone_trust.yml
          |- 1-2_zone_inetgw.yml
          |- 1-3_zone_vm.yml
          |- 1-4_nat_to-inet.yml
          |- 1-5_nat_to-common-function.yml
          |- 1-6_policy_vm_common-function.yml
          |- 1-7_policy_vm_inetgw.yml
          |- 1-8_policy_vm_trust.yml
          |- 1-9_policy_trust_vm.yml
          |- 1-10_policy_inetgw_trust.yml
          |- 1-11_policy_inetgw_vm.yml
          |- 1-12_static-route.yml
          |- 1-13_vrrp-interface0.yml
          |- 1-14_vrrp-interface1.yml
          |- 1-15_vrrp-interface2.yml
          |- 1-16_vrrp-interface3.yml
          |- show_configuration.yml
    
  2. 以下のコマンドを実行し、操作対象に関する情報を記載します。
    # vi hosts
    
    [vsrx01]
    172.16.202.8
    
    [vsrx01:vars]
    ansible_user=sub-user
    ansible_password=<サブユーザーのパスワード>
    ansible_network_os=junos
    ansible_connection=netconf
    
    [vsrx02]
    172.16.202.9
    
    [vsrx02:vars]
    ansible_user=sub-user
    ansible_password=<サブユーザーのパスワード>
    ansible_network_os=junos
    ansible_connection=netconf
    
  3. 以下のコマンドを実行し、操作対象と実行するroleについて記載します。
    # vi playbook_vsrx01.yml
    
    - hosts: vsrx01
      gather_facts: no
      roles:
        - vsrx01_conf
    
  4. 以下のコマンドを実行し、操作対象と実行するroleについて記載します。
    # vi playbook_vsrx02.yml
    
    - hosts: vsrx02
      gather_facts: no
      roles:
        - vsrx02_conf
    
  5. 以下のコマンドを実行し、vSRX1号機の各設定の内容を記載します。
    # mkdir -p /etc/ansible/roles/vsrx01_conf/tasks
    # cd /etc/ansible/roles/vsrx01_conf/tasks
    # vi main.yml
    
    - name: 1-1.ゾーン"trust"の設定
      import_tasks: 1-1_zone_trust.yml
    
    - name: 1-2.ゾーン"inetgw_zone"の設定
      import_tasks: 1-2_zone_inetgw.yml
    
    - name: 1-3.ゾーン"vm-zone"の設定
      import_tasks: 1-3_zone_vm.yml
    
    - name: 1-4.インターネット接続ゲートウェイへのNAT設定
      import_tasks: 1-4_nat_to-inet.yml
    
    - name: 1-5.共通機能ゲートウェイへのNAT設定
      import_tasks: 1-5_nat_to-common-function.yml
    
    - name: 1-6.VMから共通機能ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-6_policy_vm_common-function.yml
    
    - name: 1-7.VMからインターネット接続ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-7_policy_vm_inetgw.yml
    
    - name: 1-8.VMからFIC接続ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-8_policy_vm_trust.yml
    
    - name: 1-9.FIC接続ゲートウェイからVMへの通信許可のポリシー設定
      import_tasks: 1-9_policy_trust_vm.yml
    
    - name: 1-10.インターネット接続ゲートウェイからFIC接続ゲートウェイへの通信拒否のポリシー設定
      import_tasks: 1-10_policy_inetgw_trust.yml
    
    - name: 1-11.インターネット接続ゲートウェイからVMへの通信拒否のポリシー設定
      import_tasks: 1-11_policy_inetgw_vm.yml
    
    - name: 1-12.スタティックルート設定
      import_tasks: 1-12_static-route.yml
    
    - name: 1-13.vrrp-interface0の設定
      import_tasks: 1-13_vrrp-interface0.yml
    
    - name: 1-14.vrrp-interface1の設定
      import_tasks: 1-14_vrrp-interface1.yml
    
    - name: 1-15.vrrp-interface2の設定
      import_tasks: 1-15_vrrp-interface2.yml
    
    - name: 1-16.vrrp-interface3の設定
      import_tasks: 1-16_vrrp-interface3.yml
    
    - name: show_configurationの実行
      import_tasks: show_configuration.yml
    
    # vi 1-1_zone_trust.yml
    
    - name: 1-1.ゾーン"trust"の設定
      junos_config:
        lines:
          - set security zones security-zone trust host-inbound-traffic system-services https
          - set security zones security-zone trust host-inbound-traffic system-services ssh
          - set security zones security-zone trust host-inbound-traffic protocols all
    
    # vi 1-2_zone_inetgw.yml
    
    - name: 1-2.ゾーン"inetgw_zone"の設定
      junos_config:
        lines:
          - set security zones security-zone inetgw_zone host-inbound-traffic system-services all
          - set security zones security-zone inetgw_zone host-inbound-traffic protocols all
          - set security zones security-zone inetgw_zone interfaces ge-0/0/2.0
    
    # vi 1-3_zone_vm.yml
    
    - name: 1-3.ゾーン"vm-zone"の設定
      junos_config:
        lines:
          - set security zones security-zone vm_zone host-inbound-traffic system-services all
          - set security zones security-zone vm_zone host-inbound-traffic protocols all
          - set security zones security-zone vm_zone interfaces ge-0/0/1.0
          - set security zones security-zone vm_zone interfaces ge-0/0/3.0
    
    # vi 1-4_nat_to-inet.yml
    
    - name: 1-4.インターネット接続ゲートウェイへのNAT設定
      junos_config:
        lines:
          - set security nat source pool snatpool_to-inetgw_1 address <インターネット接続ゲートウェイのグローバルIPアドレス/32>
          - set security nat source rule-set snat_to-inetgw_1 from zone vm_zone
          - set security nat source rule-set snat_to-inetgw_1 to zone inetgw_zone
          - set security nat source rule-set snat_to-inetgw_1 rule nat_rule_1 match source-address 172.16.201.0/24
          - set security nat source rule-set snat_to-inetgw_1 rule nat_rule_1 then source-nat pool snatpool_to-inetgw_1
    
    # vi 1-5_nat_to-common-function.yml
    
    - name: 1-5.共通機能ゲートウェイへのNAT設定
      junos_config:
        lines:
          - set security nat source rule-set snat_to-common_function_pool_1 from zone vm_zone
          - set security nat source rule-set snat_to-common_function_pool_1 to interface ge-0/0/3.0
          - set security nat source rule-set snat_to-common_function_pool_1 rule nat_rule_2 match source-address 172.16.201.0/24
          - set security nat source rule-set snat_to-common_function_pool_1 rule nat_rule_2 then source-nat interface
    
    # vi 1-6_policy_vm_common-function.yml
    
    - name: 1-6.VMから共通機能ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match source-address any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match destination-address any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match application any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common then permit
    
    # vi 1-7_policy_vm_inetgw.yml
    
    - name: 1-7.VMからインターネット接続ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match source-address any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match destination-address any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match application any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet then permit
    
    # vi 1-8_policy_vm_trust.yml
    
    - name: 1-8.VMからFIC接続ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match source-address any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match destination-address any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match application any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic then permit
    
    # vi 1-9_policy_trust_vm.yml
    
    - name: 1-9.FIC接続ゲートウェイからVMへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match source-address any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match destination-address any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match application any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm then permit
    
    # vi 1-10_policy_inetgw_trust.yml
    
    - name: 1-10.インターネット接続ゲートウェイからFIC接続ゲートウェイへの通信拒否のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match source-address any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match destination-address any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match application any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic then deny
    
    # vi 1-11_policy_inetgw_vm.yml
    
    - name: 1-11.インターネット接続ゲートウェイからVMへの通信拒否のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match source-address any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match destination-address any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match application any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm then deny
    
    # vi 1-12_static-route.yml
    
    - name: 1-12.スタティックルート設定
      junos_config:
        lines:
          - set routing-options static route 210.170.119.128/26 next-hop 172.16.202.10
          - set routing-options static route <自動構築実行環境ネットワークアドレス/xx> next-hop 172.16.202.10
          - set routing-options static route 0.0.0.0/0 next-hop 172.16.203.10
          - delete routing-options static route 0.0.0.0/0 next-hop 172.16.202.10
    
    # vi 1-13_vrrp-interface0.yml
    
    - name: 1-13.interface0/0/0のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.8/28 vrrp-group 10 virtual-address 172.16.202.7
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.8/28 vrrp-group 10 priority 200
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.8/28 vrrp-group 10 accept-data
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.8/28 vrrp-group 10 preempt
    
    # vi 1-14_vrrp-interface1.yml
    
    - name: 1-14.interface0/0/1のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.8/24 vrrp-group 20 virtual-address 172.16.201.7
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.8/24 vrrp-group 20 priority 200
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.8/24 vrrp-group 20 accept-data
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.8/24 vrrp-group 20 preempt
    
    # vi 1-15_vrrp-interface2.yml
    
    - name: 1-15.interface0/0/2のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.8/28 vrrp-group 30 virtual-address 172.16.203.7
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.8/28 vrrp-group 30 priority 200
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.8/28 vrrp-group 30 accept-data
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.8/28 vrrp-group 30 preempt
    
    # vi 1-16_vrrp-interface3.yml
    
    - name: 1-16.interface0/0/3のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.8/17 vrrp-group 40 virtual-address 169.254.0.7
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.8/17 vrrp-group 40 priority 200
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.8/17 vrrp-group 40 accept-data
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.8/17 vrrp-group 40 preempt
    
    # vi show_configuration.yml
    
    - name: show configuration
      junos_command:
        commands: show configuration
        display: set
      register: r
      when: ansible_network_os == 'junos'
    
    - debug: msg="{{ r }}"
    
  6. 以下のコマンドを実行し、vSRX2号機の各設定の内容を記載します。
    # mkdir -p /etc/ansible/roles/vsrx02_conf/tasks
    # cd /etc/ansible/roles/vsrx02_conf/tasks
    # vi main.yml
    
    - name: 1-1.ゾーン"trust"の設定
      import_tasks: 1-1_zone_trust.yml
    
    - name: 1-2.ゾーン"inetgw_zone"の設定
      import_tasks: 1-2_zone_inetgw.yml
    
    - name: 1-3.ゾーン"vm-zone"の設定
      import_tasks: 1-3_zone_vm.yml
    
    - name: 1-4.インターネット接続ゲートウェイへのNAT設定
      import_tasks: 1-4_nat_to-inet.yml
    
    - name: 1-5.共通機能ゲートウェイへのNAT設定
      import_tasks: 1-5_nat_to-common-function.yml
    
    - name: 1-6.VMから共通機能ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-6_policy_vm_common-function.yml
    
    - name: 1-7.VMからインターネット接続ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-7_policy_vm_inetgw.yml
    
    - name: 1-8.VMからFIC接続ゲートウェイへの通信許可のポリシー設定
      import_tasks: 1-8_policy_vm_trust.yml
    
    - name: 1-9.FIC接続ゲートウェイからVMへの通信許可のポリシー設定
      import_tasks: 1-9_policy_trust_vm.yml
    
    - name: 1-10.インターネット接続ゲートウェイからFIC接続ゲートウェイへの通信拒否のポリシー設定
      import_tasks: 1-10_policy_inetgw_trust.yml
    
    - name: 1-11.インターネット接続ゲートウェイからVMへの通信拒否のポリシー設定
      import_tasks: 1-11_policy_inetgw_vm.yml
    
    - name: 1-12.スタティックルート設定
      import_tasks: 1-12_static-route.yml
    
    - name: 1-13.vrrp-interface0の設定
      import_tasks: 1-13_vrrp-interface0.yml
    
    - name: 1-14.vrrp-interface1の設定
      import_tasks: 1-14_vrrp-interface1.yml
    
    - name: 1-15.vrrp-interface2の設定
      import_tasks: 1-15_vrrp-interface2.yml
    
    - name: 1-16.vrrp-interface3の設定
      import_tasks: 1-16_vrrp-interface3.yml
    
    - name: show_configurationの実行
      import_tasks: show_configuration.yml
    
    # vi 1-1_zone_trust.yml
    
    - name: 1-1.ゾーン"trust"の設定
      junos_config:
        lines:
          - set security zones security-zone trust host-inbound-traffic system-services https
          - set security zones security-zone trust host-inbound-traffic system-services ssh
          - set security zones security-zone trust host-inbound-traffic protocols all
    
    # vi 1-2_zone_inetgw.yml
    
    - name: 1-2.ゾーン"inetgw_zone"の設定
      junos_config:
        lines:
          - set security zones security-zone inetgw_zone host-inbound-traffic system-services all
          - set security zones security-zone inetgw_zone host-inbound-traffic protocols all
          - set security zones security-zone inetgw_zone interfaces ge-0/0/2.0
    
    # vi 1-3_zone_vm.yml
    
    - name: 1-3.ゾーン"vm-zone"の設定
      junos_config:
        lines:
          - set security zones security-zone vm_zone host-inbound-traffic system-services all
          - set security zones security-zone vm_zone host-inbound-traffic protocols all
          - set security zones security-zone vm_zone interfaces ge-0/0/1.0
          - set security zones security-zone vm_zone interfaces ge-0/0/3.0
    
    # vi 1-4_nat_to-inet.yml
    
    - name: 1-4.インターネット接続ゲートウェイへのNAT設定
      junos_config:
        lines:
          - set security nat source pool snatpool_to-inetgw_1 address <インターネット接続ゲートウェイのグローバルIPアドレス/32>
          - set security nat source rule-set snat_to-inetgw_1 from zone vm_zone
          - set security nat source rule-set snat_to-inetgw_1 to zone inetgw_zone
          - set security nat source rule-set snat_to-inetgw_1 rule nat_rule_1 match source-address 172.16.201.0/24
          - set security nat source rule-set snat_to-inetgw_1 rule nat_rule_1 then source-nat pool snatpool_to-inetgw_1
    
    # vi 1-5_nat_to-common-function.yml
    
    - name: 1-5.共通機能ゲートウェイへのNAT設定
      junos_config:
        lines:
          - set security nat source rule-set snat_to-common_function_pool_1 from zone vm_zone
          - set security nat source rule-set snat_to-common_function_pool_1 to interface ge-0/0/3.0
          - set security nat source rule-set snat_to-common_function_pool_1 rule nat_rule_2 match source-address 172.16.201.0/24
          - set security nat source rule-set snat_to-common_function_pool_1 rule nat_rule_2 then source-nat interface
    
    # vi 1-6_policy_vm_common-function.yml
    
    - name: 1-6.VMから共通機能ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match source-address any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match destination-address any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common match application any
          - set security policies from-zone vm_zone to-zone vm_zone policy from-vm_to-common then permit
    
    # vi 1-7_policy_vm_inetgw.yml
    
    - name: 1-7.VMからインターネット接続ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match source-address any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match destination-address any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet match application any
          - set security policies from-zone vm_zone to-zone inetgw_zone policy from-vm_to-inet then permit
    
    # vi 1-8_policy_vm_trust.yml
    
    - name: 1-8.VMからFIC接続ゲートウェイへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match source-address any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match destination-address any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic match application any
          - set security policies from-zone vm_zone to-zone trust policy from-vm_to-fic then permit
    
    # vi 1-9_policy_trust_vm.yml
    
    - name: 1-9.FIC接続ゲートウェイからVMへの通信許可のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match source-address any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match destination-address any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm match application any
          - set security policies from-zone trust to-zone vm_zone policy from-fic_to-vm then permit
    
    # vi 1-10_policy_inetgw_trust.yml
    
    - name: 1-10.インターネット接続ゲートウェイからFIC接続ゲートウェイへの通信拒否のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match source-address any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match destination-address any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic match application any
          - set security policies from-zone inetgw_zone to-zone trust policy from-inet_to-fic then deny
    
    # vi 1-11_policy_inetgw_vm.yml
    
    - name: 1-11.インターネット接続ゲートウェイからVMへの通信拒否のポリシー設定
      junos_config:
        lines:
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match source-address any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match destination-address any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm match application any
          - set security policies from-zone inetgw_zone to-zone vm_zone policy from-inet_to-vm then deny
    
    # vi 1-12_static-route.yml
    
    - name: 1-12.スタティックルート設定
      junos_config:
        lines:
          - set routing-options static route 210.170.119.128/26 next-hop 172.16.202.10
          - set routing-options static route <自動構築実行環境ネットワークアドレス/xx> next-hop 172.16.202.10
          - set routing-options static route 0.0.0.0/0 next-hop 172.16.203.10
          - delete routing-options static route 0.0.0.0/0 next-hop 172.16.202.10
    
    # vi 1-13_vrrp-interface0.yml
    
    - name: 1-13.interface0/0/0のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.9/28 vrrp-group 10 virtual-address 172.16.202.7
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.9/28 vrrp-group 10 priority 100
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.9/28 vrrp-group 10 accept-data
          - set interfaces ge-0/0/0 unit 0 family inet address 172.16.202.9/28 vrrp-group 10 preempt
    
    # vi 1-14_vrrp-interface1.yml
    
    - name: 1-14.interface0/0/1のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.9/24 vrrp-group 20 virtual-address 172.16.201.7
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.9/24 vrrp-group 20 priority 100
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.9/24 vrrp-group 20 accept-data
          - set interfaces ge-0/0/1 unit 0 family inet address 172.16.201.9/24 vrrp-group 20 preempt
    
    # vi 1-15_vrrp-interface2.yml
    
    - name: 1-15.interface0/0/2のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.9/28 vrrp-group 30 virtual-address 172.16.203.7
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.9/28 vrrp-group 30 priority 100
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.9/28 vrrp-group 30 accept-data
          - set interfaces ge-0/0/2 unit 0 family inet address 172.16.203.9/28 vrrp-group 30 preempt
    
    # vi 1-16_vrrp-interface3.yml
    
    - name: 1-16.interface0/0/3のVRRP設定
      junos_config:
        lines:
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.9/17 vrrp-group 40 virtual-address 169.254.0.7
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.9/17 vrrp-group 40 priority 100
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.9/17 vrrp-group 40 accept-data
          - set interfaces ge-0/0/3 unit 0 family inet address 169.254.0.9/17 vrrp-group 40 preempt
    
    # vi show_configuration.yml
    
    - name: show configuration
      junos_command:
        commands: show configuration
        display: set
      register: r
      when: ansible_network_os == 'junos'
    
    - debug: msg="{{ r }}"