title: best way to modify json in ansible
body: <p>I have a variable (via set_fact) containing a json string:</p>
  
  <pre><code>{
    "PolicyVersion": {
      "CreateDate": "2017-08-07T02:48:05Z",
      "Document": {
        "Statement": [
          {
            "Action": "sts:AssumeRole",
            "Effect": "Allow",
            "Resource": [
              "arn:aws:iam::123456789123:role/Root_Update_svcacct",
              "arn:aws:iam::123456789123:role/Root_Delete_svcacct",
              "arn:aws:iam::123456789123:role/Root_Create_svcacct",
              "arn:aws:iam::123456789123:role/Root_Full_svcacct",
              "arn:aws:iam::987654321987:role/Member1_Create_svcacct",
              "arn:aws:iam::987654321987:role/Member1_Update_svcacct",
              "arn:aws:iam::987654321987:role/Member1_Delete_svcacct",
              "arn:aws:iam::987654321987:role/Member1_Full_svcacct"
            ]
          }
        ],
        "Version": "2012-10-17"
      },
      "IsDefaultVersion": true,
      "VersionId": "v2"
    }
  }
  </code></pre>
  
  <p>What is the best way to insert more elements in the "Resource" array?</p>
  
  <pre><code>"arn:aws:iam::001122334455:role/Member1_Create_svcacct",
  "arn:aws:iam::001122334455:role/Member1_Update_svcacct",
  "arn:aws:iam::001122334455:role/Member1_Delete_svcacct",
  "arn:aws:iam::001122334455:role/Member1_Full_svcacct"
  </code></pre>
  
  <p>I am exploring dumping the variable to a file and inserting the block I want with external shell tools, which does not seem to be elegant. </p>