見出し画像

20200110_まなんだこと

※昨日書いて投稿するの謎にわすれてたので、日付が昨日。

JANOG45のLT、不採用でした~

「アブストは自信満々にちゃんと書け」という教訓を得ました。


まなんだこと1 :スペルミスは意外とやる

Ansibleのuri moduleを使ってPlaybookを書いていたのですが、parameterの"url"を勝手に"uri"だと勘違いして書き続けていた話です。

ちなみに以下のようなPlaybookを書いていて、

      - name: configure detail dns view
       uri:
         uri: https://{{ nios_provider.host }}/wapi/v2.7.3/view  ★ほんとは"url"
         method: POST
         user: "{{ nios_provider.username }}"
         password: "{{ nios_provider.password }}"
         body: "{{ content_dnsview_yml | to_json }}"
         status_code: 201, 400
         headers:
             Content-Type: "application/json"
         validate_certs: no
       register: config_dnsviewdetail
       changed_when: config_dnsviewdetail.status == 201
       vars:
         content_dnsview_yml:
           name: cache
           comment: Created with Ansible
           match_clients: ACL_Group
           match_destinations: xx.xx.xx.xx

以下のようなエラーをずっと吐いていました。

   "msg": "The conditional check 'config_dnsviewdetail.status == 201' failed. The error was: error while evaluating conditional (config_dnsviewdetail.status == 201): 'dict object' has no attribute 'status'" 

syntax errorとかでもないので、なんだろう・・・と思って色々調べたのに解消できなくて、他の人に聞いたらこのミスが発覚しました。。


まなんだこと2 :"when:"のつくサブ構文?は、値に{{ }}を使っちゃダメ

↑のトラシュー()をしていて、changed_whenのいろんな書き方を試していたときに知ったこと。詳しくはこちら

ちなみに以下のようなエラーを吐かれました。

[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: "{{ config_dnsviewdetail.status }}" == 201



この記事が気に入ったらサポートをしてみませんか?