---
- name: "β³ Wait for PDS XRPC to come up at {{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/_health"
uri_retry:
url: "{{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/_health"
method: GET
status_code: 200
validate_certs: false
register: bluesky_pds_health
retries: 30
delay: 2
until: bluesky_pds_health.status == 200
- name: "π Create native PDS administrator account (idempotent)"
uri_retry:
url: "{{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/com.atproto.server.createAccount"
method: POST
headers:
Content-Type: application/json
body_format: json
body:
handle: "{{ BLUESKY_ADMIN_HANDLE }}"
email: "{{ BLUESKY_ADMIN_EMAIL }}"
password: "{{ BLUESKY_ADMIN_PASSWORD }}"
status_code: [200, 400]
validate_certs: false
return_content: true
register: bluesky_admin_create
changed_when:
- bluesky_admin_create.status == 200
failed_when:
- bluesky_admin_create.status != 200
- "'Handle already taken' not in (bluesky_admin_create.content | default(''))"
- "'Reserved handle' not in (bluesky_admin_create.content | default(''))"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: "π Create the native PDS admin account with the i8- prefix (idempotent)"
uri_retry:
url: "{{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/com.atproto.server.createAccount"
method: POST
headers:
Content-Type: application/json
body_format: json
body:
handle: "{{ BLUESKY_ADMIN_HANDLE_RESERVED }}"
email: "{{ BLUESKY_ADMIN_EMAIL }}"
password: "{{ BLUESKY_ADMIN_PASSWORD }}"
status_code: [200, 400]
validate_certs: false
return_content: true
register: bluesky_admin_create_reserved
changed_when:
- bluesky_admin_create_reserved.status == 200
failed_when:
- bluesky_admin_create_reserved.status != 200
- "'Handle already taken' not in (bluesky_admin_create_reserved.content | default(''))"
when: "'Reserved handle' in (bluesky_admin_create.content | default(''))"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: "π Realign the password an existing native PDS administrator kept"
when: bluesky_admin_create.status != 200
block:
- name: "π Resolve the DID of the native PDS administrator handle"
uri_retry:
url: "{{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/com.atproto.identity.resolveHandle?handle={{ BLUESKY_ADMIN_HANDLE | urlencode }}"
method: GET
status_code: 200
validate_certs: false
register: bluesky_admin_did
changed_when: false
- name: "π Set the native administrator password through the admin API"
uri_retry:
url: "{{ BLUESKY_PDS_INTERNAL_URL }}/xrpc/com.atproto.admin.updateAccountPassword"
method: POST
headers:
Content-Type: application/json
Authorization: "Basic {{ ('admin:' ~ BLUESKY_ADMIN_PASSWORD) | b64encode }}"
body_format: json
body:
did: "{{ bluesky_admin_did.json.did }}"
password: "{{ BLUESKY_ADMIN_PASSWORD }}"
status_code: 200
validate_certs: false
changed_when: true
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"