generated from ansible-collections/collection_template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
context/target | ||
setup/once/setup_sqlserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- setup_sqlserver_test_plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
- name: Var block | ||
vars: | ||
login_name: "PhillipJFry" | ||
plain_password: "P0pS3cret!23$%" | ||
password_expiration_enabled: false | ||
password_policy_enforced: false | ||
password_must_change: false | ||
enabled: false | ||
default_database: "master" | ||
language: "us_english" | ||
default_schema: "dbo" | ||
database: "master" | ||
server_role: "sysadmin" | ||
module_defaults: | ||
lowlydba.sqlserver.login: | ||
sql_instance: "{{ sqlserver_instance }}" | ||
sql_username: "{{ sqlserver_username }}" | ||
sql_password: "{{ sqlserver_password }}" | ||
default_database: "{{ default_database }}" | ||
login: "{{ login_name }}" | ||
password: "{{ plain_password }}" | ||
password_expiration_enabled: "{{ password_expiration_enabled }}" | ||
password_must_change: "{{ password_must_change }}" | ||
enabled: "{{ enabled }}" | ||
language: "{{ language }}" | ||
state: present | ||
lowlydba.sqlserver.login_role: | ||
sql_instance: "{{ sqlserver_instance }}" | ||
sql_username: "{{ sqlserver_username }}" | ||
sql_password: "{{ sqlserver_password }}" | ||
server_role: "{{ database }}" | ||
login: "{{ login_name }}" | ||
state: present | ||
tags: ["sqlserver.user"] | ||
block: | ||
- name: Create login | ||
lowlydba.sqlserver.login: | ||
register: result | ||
- assert: | ||
that: | ||
- result.data != None | ||
|
||
- name: Add login to server role | ||
lowlydba.sqlserver.login_role: | ||
register: result | ||
- assert: | ||
that: | ||
- result is changed | ||
|
||
- name: Add login to non-existent server role | ||
lowlydba.sqlserver.login_role: | ||
server_role: IMadeThisOneUp | ||
register: error_result | ||
failed_when: error_result.failed | ||
ignore_errors: true | ||
- assert: | ||
that: | ||
- error_result.failed == true | ||
- "'Server role [IMadeThisOneUp] does not exist' in error_result.msg" | ||
|
||
- name: Add non-existent login to server role | ||
lowlydba.sqlserver.login_role: | ||
login: NewUserWhoThis | ||
register: error_result | ||
failed_when: error_result.failed | ||
ignore_errors: true | ||
- assert: | ||
that: | ||
- error_result.failed == true | ||
- "'Login [NewUserWhoThis] does not exist' in error_result.msg" | ||
|
||
- name: Add Login again to database role | ||
lowlydba.sqlserver.login_role: | ||
register: result | ||
- assert: | ||
that: | ||
- result is not changed | ||
|
||
- name: Remove login from server role | ||
lowlydba.sqlserver.login_role: | ||
state: "absent" | ||
register: result | ||
- assert: | ||
that: | ||
- result is changed | ||
|
||
always: | ||
- name: Drop login | ||
lowlydba.sqlserver.login: | ||
state: "absent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
windows/all | ||
windows/group/2 | ||
context/target | ||
setup/once/setup_win_sqlserver | ||
needs/target/login_role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- login_role |