Permissions ex is not working - minecraft

I am trying to make a kit pvp server and my players are not being able to use signs at all!
groups:
Initiate:
options:
default: 'true'
prefix: '&0[&3Initiate&0]&f'
permissions:
- modifyworld.*
- essentials.eco
- essentials.pay
- essentials.pay.multiple
- essentials.afk
- essentials.afk.auto
- essentials.mail
- essentials.mail.send
- essentials.msg
- essentials.rules
- essentials.seen
- essentials.seen.banreason
- essentials.suicide
- essentials.spawn
- essentials.keepxp
- essentials.warp
- essentials.warp.list
- essentials.warp.afireandice
- essentials.warp.forestlyr
- essentials.warp.mainplains
- essentials.warp.spawn
- essentials.signs.use.balance
- essentials.signs.use.buy
- essentials.signs.use.disposal
- essentials.signs.use.free
- essentials.signs.use.heal
- essentials.signs.use.info
- essentials.signs.use.mail
- essentials.signs.use.repair
- essentials.signs.use.sell
- essentials.signs.use.warp
- kingkits.command.previewkit
- kingkits.sign.list.use
- kingkits.sign.kit.use
- kingkits.compass
- kingkits.quicksoup
schema-version: 1
users:
9bb304e6-2ff2-4acc-b073-d899993e157d:
group: []
options:
name: CraigSwords
7225aabb-6ae9-4081-add2-00dbdd6d114c:
group: []
options:
name: SocialSavior
b4c5a860-8e01-4306-99c7-3457e935eed3:
group: []
options:
name: mewtwolvex
7f1e5c73-3fac-4b5e-b7ed-6661740470a7:
group: []
options:
name: Slick10000

Your Initiate group permissions appear to be correct. Even though this group is configured to be the default group, it is not assigned to your players since you have explicit group definitions for all (i.e. group: []). Removing the empty group definitions from your players will cause PEX to assign them to your default Initiate group.

Related

Remove subelement from a yaml array in bash/awk when there's no order?

I'm trying to find a better way of removing values from a yaml, for example - this is my yaml example:
apiVersion: v1
data:
mapRoles: |-
- username: user1
rolearn: arn
groups:
- grp
- grp2
- groups:
- grp
rolearn: arn
username: user2
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"..."}
uid: 93ad6dc1-2a1f-11ea-b5da-0ec0e91c7076
my input is list of user names, which i can test with regex or. as i cannot install any dependencies, i have to use a tool that is installed in any system - thats what i chose awk.
in each part, i have to check the username if it matches any list of values, then if it does - remove a specific group from the "groups:" list.
what i was thinking is to identify each start of a yaml key (that represents a user) - then, add everything to an array while checking if the username is exactly what we expect - if it does, print the array but without the relevant group, else - print the entire array.
i've started writing it and it seems complex - is there any better way?
--- examples ---
If i'm specifying "user1" and the "grp" as the params, yaml should look like:
apiVersion: v1
data:
mapRoles: |-
- username: user1
rolearn: arn
groups:
- grp2
- groups:
- grp
rolearn: arn
username: user2
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"..."}
uid: 93ad6dc1-2a1f-11ea-b5da-0ec0e91c7076
if i'm specifying user2 and the "grp", it should look like:
apiVersion: v1
data:
mapRoles: |-
- username: user1
rolearn: arn
groups:
- grp
- grp2
- groups:
rolearn: arn
username: user2
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"..."}
uid: 93ad6dc1-2a1f-11ea-b5da-0ec0e91c7076
That's my issue - basically the user2 is specified AFTER the groups section, which then i'm not sure about the correct way to remove it.
This might be what you're trying to do but its not clear from your question:
$ cat tst.awk
BEGIN {
split(users,tmp)
for (i in tmp) {
tgtUsers[tmp[i]]
}
split(groups,tmp)
for (i in tmp) {
tgtGroups[tmp[i]]
}
}
match($0,/^[[:space:]]*(-[[:space:]]*)?[^[:space:]]+[[:space:]]*:/) {
sect = $0
sub(/^[[:space:]]*(-[[:space:]]*)?/,"",sect)
sub(/[[:space:]]*:.*/,"",sect)
}
sect == "username" {
inTgtUsers = ($NF in tgtUsers)
inGroups = 0
}
sect == "groups" {
inGroups = 1
}
!(inGroups && inTgtUsers && ($NF in tgtGroups))
$ awk -v users='user1' -v groups='grp' -f tst.awk file
apiVersion: v1
data:
mapRoles: |-
- username: user1
rolearn: arn
groups:
- grp2
- groups:
rolearn: arn
username: user2
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"..."}
uid: 93ad6dc1-2a1f-11ea-b5da-0ec0e91c7076
So, by the note of Ed Morton, i've taken his script, but had to change the regex, as it didn't catch groups with colons in the name (such as - my:group)
BEGIN {
inGroups = 0
split(users,tmp)
for (i in tmp) {
tgtUsers[tmp[i]]
}
split(groups,tmp)
for (i in tmp) {
tgtGroups[tmp[i]]
}
}
match($0,/^ +(-? (username|rolearn|userarn): [^ ]+|-? groups: *$)/) {
sect = $0
sub(/^[[:space:]]*(-[[:space:]]*)?/,"",sect)
sub(/[[:space:]]*:.*/,"",sect)
if ($1 == "-") {
startIndexArr[NR]
start_index = NR
}
inGroups = 0
}
sect == "username" {
if ($NF in tgtUsers)
relevantUsersIndexArr[start_index]
}
sect == "groups" {
inGroups = 1
}
(inGroups == 1 && ($NF in tgtGroups)) {
foundGroupsArr[NR]
}
{
yamlArr[NR] = $0
}
END {
row_num = 1
for (i in yamlArr) {
if (row_num in startIndexArr)
start_entity_index = row_num
print_row = 1
if (row_num in foundGroupsArr && start_entity_index in relevantUsersIndexArr)
print_row = 0
if (print_row == 1)
print yamlArr[row_num]
row_num++
}
}

Querying case-insensitive columns by SQL in Tarantool

We know that string Tarantool indices can be made case-insensitive by specifying the collation option: collation = "unicode_ci". E.g.:
t = box.schema.create_space("test")
t:format({{name = "id", type = "number"}, {name = "col1", type = "string"}})
t:create_index('primary')
t:create_index("col1_idx", {parts = {{field = "col1", type = "string", collation = "unicode_ci"}}})
t:insert{1, "aaa"}
t:insert{2, "bbb"}
t:insert{3, "ccc"}
Now we can do a case-insensitive query:
tarantool> t.index.col1_idx:select("AAA")
---
- - [1, 'aaa']
...
But how to do it using SQL? This doesn't work:
tarantool> box.execute("select * from \"test\" where \"col1\" = 'AAA'")
---
- metadata:
- name: id
type: number
- name: col1
type: string
rows: []
...
Neither does this:
tarantool> box.execute("select * from \"test\" indexed by \"col1_idx\" where \"col1\" = 'AAA'")
---
- metadata:
- name: id
type: number
- name: col1
type: string
rows: []
...
There's a dirty trick with a poor performance (full scan). We don't want it, do we?
tarantool> box.execute("select * from \"test\" indexed by \"col1_idx\" where upper(\"col1\") = 'AAA'")
---
- metadata:
- name: id
type: number
- name: col1
type: string
rows:
- [1, 'aaa']
...
At last, we have one more workaround:
tarantool> box.execute("select * from \"test\" where \"col1\" = 'AAA' collate \"unicode_ci\"")
---
- metadata:
- name: id
type: number
- name: col1
type: string
rows:
- [1, 'aaa']
...
But the question is - does it use the index? Without an index it also works...
One can check query plan to figure out whether particular index is used or not. To get query plan simply add 'EXPLAIN QUERY PLAN ' prefix to the original query. For instance:
tarantool> box.execute("explain query plan select * from \"test\" where \"col1\" = 'AAA' collate \"unicode_ci\"")
---
- metadata:
- name: selectid
type: integer
- name: order
type: integer
- name: from
type: integer
- name: detail
type: text
rows:
- [0, 0, 0, 'SEARCH TABLE test USING COVERING INDEX col1_idx (col1=?) (~1 row)']
...
So the answer is 'yes', index is used in this case.
As for another example:
box.execute("select * from \"test\" indexed by \"col1_idx\" where \"col1\" = 'AAA'")
Unfortunately collation in this comparison is binary, since index's collation is ignored. In SQL only column's collations are considered to be used during comparison. This limitation will be resolved as soon as corresponding issue is closed.

Replace string either lowercase or uppercase

I am writing a playbook to replace a string in three files. That string can be written either in lowercase or uppercase. Here is my code :
---
- name: "Modif string"
hosts: myhosts
tasks:
- name: "Replace line"
replace:
path: ~/Documents/{{ item }}
regexp: 'test'
replace: 'new'
with_items:
- 'file'
- 'file1'
- 'file2'
How can I make it work so the string 'test' is amended either it is written in lowercase or uppercase? Also what if there is randomly letter uppercase or lowercase in that string?
Thank you all.
Try as below
- name: "Replace line"
replace:
path: ~/Documents/{{ item }}
regexp: '(?i)test'
replace: 'new'
I finally wrote that script. Works like a charm.
- name: "Other test"
hosts: raspi
vars:
text_to_replace:
- {regexp: '(?i)(test)', line: 'new'}
- {regexp: '10', line: '20'}
my_files:
- {file: 'file'}
- {file: 'file1'}
- {file: 'file2'}
tasks:
- name: "Replace"
replace:
path: ~/test/{{item.1.file}}
regexp: "{{item.0.regexp}}"
replace: "{{item.0.line}}"
with_nested:
- "{{text_to_replace}}"
- "{{my_files}}"

Set fact with dynamic key name in ansible

I am trying to shrink several chunks of similar code which looks like:
- ... multiple things is going here
register: list_register
- name: Generating list
set_fact: my_list="{{ list_register.results | map(attribute='ansible_facts.list_item') | list }}"
# the same code repeats...
The only difference between them is list name instead of my_list.
In fact, I want to do this:
set_fact:
"{{ some var }}" : "{{ some value }}"
I came across this post but didn't find any answer here.
Is it possible to do so or is there any workaround?
take a look at this sample playbook:
---
- hosts: localhost
vars:
iter:
- key: abc
val: xyz
- key: efg
val: uvw
tasks:
- set_fact: {"{{ item.key }}":"{{ item.val }}"}
with_items: "{{iter}}"
- debug: msg="key={{item.key}}, hostvar={{hostvars['localhost'][item.key]}}"
with_items: "{{iter}}"
The above does not work for me. What finally works is
- set_fact:
example_dict: "{'{{ some var }}':'{{ some other var }}'}"
Which is in the end obvious. You construct a string (the outer double quotes) which is then interpreted as a hash. In hashes key and value must be single quotes (the inner single quotes around the variable replacements). And finally you just place your variable replacements as in any other string.
Stefan
As of 2018, using ansible v2.7.1, the syntax you suggest in your post works perfectly well.
At least in my case, I have this in role "a" :
- name: Set fact
set_fact:
"{{ variable_name }}": "{{ variable_value }}"
And that in role "b" :
- debug:
msg: "variable_name = {{ variable_name }}"
And execution goes :
TASK [role a : Set fact] *******************************************************
ok: [host_name] => {
"ansible_facts": {
"variable_name": "actual value"
},
"changed": false
}
...
TASK [role b : debug] **********************************************************
ok: [host_name] => {}
MSG:
variable_name = actual value
- set_fact: '{{ some_var }}={{ some_value }}'
It creates a string of inline module parameter expression by concatenating value of some_var (fact name), separator = and value of some_value (fact value).
- set_fact:
var1={"{{variable_name}}":"{{ some value }}"}
This will create a variable "var1" with your dynamic variable key and value.
Example: I used this for creating dynamic tags in AWS Autoscaling group for creating kubernetes tags for the instances like this:
- name: Dynamic clustertag
set_fact:
clustertag={"kubernetes.io/cluster/{{ clustername }}":"owned"}
- name: Create the auto scale group
ec2_asg:
.
.
.
tags:
- "{{ clustertag }}"
Beware of a change in 2.9 – the behaviour changed rendering all the answers invalid. https://github.com/ansible/ansible/issues/64169

Minecraft PermissionsEX not working

Ok so my problem is that my minecraft server will not read this so it comes up with no permissions at all. I have typed this from scratch following all of the guide-lines. I have tried altering the big and the small and testing each time and can come up with anything thank, Pokpok300 ~Ben
groups:
Player:
default: 'true'
options:
rank: '1000'
prefix: '&0[&2Player&0]'
Permissions:
-essentials.kit
-essentials.balance
-essentials.balancetop
-essentials.pay
-essentials.afk
-essentials.afkauto
-essentials.customtext
-essentials.help
-essentials.helpop
-essentials.mail*
-essentials.me
-essentials.msg*
-essentials.rules
-essentials.spawn
-essentials.delhome
-essentials.home
-essentials.sethome
-essentials.tpaccept
-essentials.tpahere
-essentials.tpdeny
-essentials.warp
-essentials.warp.list
Member:
inheritance:
- Player
options:
rank: '900'
prefix: '&0[&3Member&0]'
Permissions:
-essentials.ignore
-essentials.suicide
Member+:
inheritance:
- Member
options:
prefix: '&0[&3Member+0]'
rank: '500'
Permissions:
-essentials.recipe
-essentials.enderchest
Trial-Mod:
inheritance:
- Member+
options:
prefix: '&0[&7Trial-Mod&0]'
rank: '400'
Permissions:
-essentials.tree*
-essentials.workbench*
-essentials.realname
-essentials.whois*
-essentials.jails
-essentials.kick
-essentials.mute*
-essentials.tempban*
-essentials.togglejail*
-essentials.weather
-essentials.jump
Mod:
inheritance:
- Trial-Mod
options:
prefix: '&0[&7Mod&0]'
rank: '300'
Permissions:
-essentials.fly*
-essentials.time*
-essentials.helpop*
-essentials.spawner*
-essentials.invsee*
-essentials.vanish*
-essentials.back
-essentials.sethome.multiple.3
-essentials.tpaall
-essentials.world*
Trial-Admin:
inheritance:
- Mod
options:
prefix: '&0[&1Trial-Admin&0]'
rank: '200'
Permissions:
-essentials.gamemode*
-essentials.give*
-essentials.god*
-essentials.heal*
-essentials.repair*
-essentials.unlimited*
-essentials.ignore*
-essentials.ban*
-essentials.banip*
-essentials.clearinventory*
-essentials.enderchest*
-essentials.fireball
-essentials.kickall*
-essentials.kill*
-essentials.remove*
-essentials.unban*
-essentials.unbanip*
-essentials.top*
Admin:
inheritance:
- Trial-Admin
options:
prefix: '&0[&1Admin&0]'
rank: '100'
Permissions:
-essentials.exp*
-essentials.feed*
-essentials.more*
-essentials.speed*
-essentials.powertool*
-essentials.powertooltoggle*
-essentials.backup*
-essentials.broadcast
-essentials.deljail
-essentials.setjail
-essentials.setspawn
-essentials.delwarp
-essentials.sethome*
-essentials.tpall*
-essentials.tphere*
-essentials.tpo*
-essentials.tpohere*
-essentials.tppos*
-essentials.tptoggle*
Co-Owner:
inheritance:
- Admin
options:
prefix: '&0[&6Co-Owner&0]'
rank: '50'
Permissions:
Owner:
inheritance:
- Co-Owner
options:
prefix: '&0[&9Owner&0]'
rank: '1'
Permissions:
-essentials.nuke*
Dontator:
inheritance:
- Member+
options:
prefix: '&0[&2Dontator&0]'
Permissions:
-essentials.workbench*
-essentials.recipe
Dontator+:
inheritance:
- Dontator
options:
prefix: '&0[&2Dontator+&0]'
Permissions:
-essentials.nick
-essentials.nick.color
Dontator++:
inheritance:
- Dontator++
options:
prefix: '&0[&2Dontator++&0]'
Permissions:
-essentials.nick
-essentials.nick.color
-essentials.nick.magic
-essentials.nick.format
CustomDontator:
options:
prefix: '&0[&2Dontator+++&0]'
Permissions:
I see you are new at this... So I fixed everything up!
groups:
Player:
default: 'true'
options:
rank: '1000'
prefix: '&0[&2Player&0]'
permissions:
- essentials.kit
- essentials.balance
- essentials.balancetop
- essentials.pay
- essentials.afk
- essentials.afk.auto
- essentials.customtext
- essentials.help
- essentials.helpop
- essentials.mail.*
- essentials.me
- essentials.msg.*
- essentials.rules
- essentials.spawn
- essentials.delhome
- essentials.home
- essentials.sethome
- essentials.tpaccept
- essentials.tpahere
- essentials.tpdeny
- essentials.warp
- essentials.warp.list
Member:
inheritance:
- Player
options:
rank: '900'
prefix: '&0[&3Member&0]'
permissions:
- essentials.ignore
- essentials.suicide
Member+:
inheritance:
- Member
options:
prefix: '&0[&3Member+0]'
rank: '500'
Permissions:
- essentials.recipe
- essentials.enderchest
Trial-Mod:
inheritance:
- Member+
options:
prefix: '&0[&7Trial-Mod&0]'
rank: '400'
permissions:
- essentials.tree
- essentials.workbench
- essentials.realname
- essentials.whois
- essentials.jail
- essentials.kick
- essentials.mute
- essentials.tempban
- essentials.togglejail
- essentials.weather
- essentials.jump
Mod:
inheritance:
- Trial-Mod
options:
prefix: '&0[&7Mod&0]'
rank: '300'
permissions:
- essentials.fly
- essentials.time
- essentials.helpop
- essentials.spawner
- essentials.invsee
- essentials.vanish
- essentials.back
- essentials.sethome.multiple.3
- essentials.tpaall
- essentials.world
Trial-Admin:
inheritance:
- Mod
options:
prefix: '&0[&1Trial-Admin&0]'
rank: '200'
permissions:
- essentials.gamemode
- essentials.give
- essentials.god
- essentials.heal
- essentials.repair
- essentials.unlimited
- essentials.ignore
- essentials.ban
- essentials.banip
- essentials.clearinventory
- essentials.enderchest
- essentials.fireball
- essentials.kickall
- essentials.kill
- essentials.remove
- essentials.pardon
- essentials.pardonip
- essentials.top
Admin:
inheritance:
- Trial-Admin
options:
prefix: '&0[&1Admin&0]'
rank: '100'
permissions:
- essentials.exp
- essentials.feed
- essentials.more
- essentials.speed
- essentials.powertool
- essentials.powertooltoggle
- essentials.backup
- essentials.broadcast
- essentials.deljail
- essentials.setjail
- essentials.setspawn
- essentials.delwarp
- essentials.sethome
- essentials.tpall
- essentials.tpa
- essentials.tpahere
- essentials.tppos
- essentials.tptoggle
Co-Owner:
inheritance:
- Admin
options:
prefix: '&0[&6Co-Owner&0]'
rank: '50'
permissions:
Owner:
inheritance:
- Co-Owner
options:
prefix: '&0[&9Owner&0]'
rank: '1'
Permissions:
- essentials.nuke
Dontator:
inheritance:
- Member+
options:
prefix: '&0[&2Dontator&0]'
default: false
Permissions:
- essentials.workbench
- essentials.recipe
Dontator+:
inheritance:
- Dontator
options:
prefix: '&0[&2Dontator+&0]'
default: false
permissions:
- essentials.nick
- essentials.nick.color
Dontator++:
inheritance:
- Dontator++
options:
prefix: '&0[&2Dontator++&0]'
default: false
permissions:
- essentials.nick
- essentials.nick.color
- essentials.nick.magic
- essentials.nick.format
CustomDontator:
options:
prefix: '&0[&2Dontator+++&0]'
default: false
Permissions: